import axios from 'axios';
import MockAdapter from 'axios-mock-adapter';
import { LoginUsers,apply_list,apply_add1, Users,device_event,Forwarding_data,rules_manage,device_list, Dashboard,accountZhangHu,news,business_log,
	products_manage,products_list,products_stable,products_drive,apply_add3 } from './data/user';
import Mock from 'mockjs';
let _Users = Users;
let _Dashboard = Dashboard;
let _products_manage = products_manage;
let _products_list = products_list;
let _products_stable = products_stable;
let _products_drive = products_drive;
let _apply_add3 = apply_add3;
let _accountZhangHu = accountZhangHu;
let _news = news;
let _business_log = business_log;
let _device_event = device_event;
let _device_list = device_list;
let _rules_manage = rules_manage;
let _Forwarding_data = Forwarding_data;
let _apply_list = apply_list;
let _apply_add1 = apply_add1;
export default {
	/**
   * mock bootstrap
   */
	bootstrap() {
		let mock = new MockAdapter(axios);
		mock.onGet('/success').reply(200, {
			msg: 'success'
		});
		mock.onGet('/error').reply(500, {
			msg: 'failure'
		});
		//登录
		mock.onPost('/login').reply(config => {
			let {username, password} = JSON.parse(config.data);
			return new Promise((resolve, reject) => {
				let user = null;
				setTimeout(() => {
					let hasUser = LoginUsers.some(u => {
						if (u.username === username && u.password === password) {
							user = JSON.parse(JSON.stringify(u));
							return true;
						}
					});
					if (hasUser) {
						resolve([200, { code: 200, msg: '请求成功', user }]);
					} else {
						resolve([200, { code: 500, msg: '账号或密码错误' }]);
					}
				}, 1000);
			});
		});
		//获取用户列表
		mock.onGet('/user/list').reply(config => {
			let {name} = config.params;
			// 报警信息
			if (config.params.table=="报警信息") {
				let mockDashboard = _Dashboard.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				console.log(mockDashboard);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							dashboard: mockDashboard
						}]);
					}, 1000);
				});
			}
			// 策略分析
			if (config.params.table=="策略分析") {
				let mockUsers = _Users.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							users: mockUsers
						}]);
					}, 1000);
				});
			}
			// 产品管理
			if (config.params.table=="产品管理") {
				let products_manage = _products_manage.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							products_manage: products_manage
						}]);
					}, 1000);
				});
			}
			// 设备管理
			if (config.params.table=="设备管理") {
				// 策略绑定
				let celueData = _Users.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				// 设备管理
				let products_list = _products_list.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							products_list: products_list,
							celueData:celueData
						}]);
					}, 1000);
				});
			}
			// 产品固件
			if (config.params.table=="产品固件") {
				let products_stable = products_stable.filter(user => {
					if (name && user.name.indexOf(name) == -1 && version && user.version.indexOf(version) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							products_stable: products_stable
						}]);
					}, 1000);
				});
			}
			// 产品驱动
			if (config.params.table=="产品驱动") {
				let products_drive = products_drive.filter(user => {
					if (name && user.name.indexOf(name) == -1 && version && user.version.indexOf(version) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							products_drive: products_drive
						}]);
					}, 1000);
				});
			}
			// 应用添加
			if (config.params.table=="应用添加") {
				let apply_add3 = apply_add3.filter(user => {
					if (name && user.name.indexOf(name) == -1 && version && user.version.indexOf(version) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							apply_add3: apply_add3
						}]);
					}, 1000);
				});
			}
			// 账号管理
			if (config.params.table=="账号管理") {
				let accountZhangHu = accountZhangHu.filter(user => {
					if (name && user.name.indexOf(name) == -1 || account && user.account.indexOf(account) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							accountZhangHu: accountZhangHu
						}]);
					}, 1000);
				});
			}
			// 消息测试
			if (config.params.table=="消息测试") {
				let news = news.filter(user => {
					if (name && user.name.indexOf(name) == -1 || account && user.account.indexOf(account) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							news: news
						}]);
					}, 1000);
				});
			}
			// 业务日志
			if (config.params.table=="业务日志") {
				let business_log = business_log.filter(user => {
					if (name && user.name.indexOf(name) == -1 || account && user.account.indexOf(account) == -1) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							business_log: business_log
						}]);
					}, 1000);
				});
			}
			// 事件管理
			if (config.params.table=="事件管理") {
				let device_event = device_event.filter(user => {
					if (name && user.name.indexOf(name) == -1 ) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							device_event: device_event
						}]);
					}, 1000);
				});
			}
			// 网关管理
			if (config.params.table=="网关管理") {
				let device_list = device_list.filter(user => {
					if (name && user.name.indexOf(name) == -1 ) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							device_list: device_list
						}]);
					}, 1000);
				});
			}
			// 规则管理
			if (config.params.table=="规则管理") {
				let rules_manage = rules_manage.filter(user => {
					if (name && user.name.indexOf(name) == -1 ) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							rules_manage: rules_manage
						}]);
					}, 1000);
				});
			}
			// 转发数据
			if (config.params.table=="转发数据") {
				let Forwarding_data = Forwarding_data.filter(user => {
					if (name && user.name.indexOf(name) == -1 ) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							Forwarding_data: Forwarding_data
						}]);
					}, 1000);
				});
			}
			// 应用展览
			if (config.params.table=="转发数据") {
				let apply_list = apply_list.filter(user => {
					if (name && user.name.indexOf(name) == -1 ) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							apply_list: apply_list
						}]);
					}, 1000);
				});
			}
			// 应用类型
			if (config.params.table=="应用类型") {
				let apply_add1 = apply_add1.filter(user => {
					if (name && user.name.indexOf(name) == -1 ) {return false;}
					return true;
				});
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							apply_add1: apply_add1
						}]);
					}, 1000);
				});
			}
		});
		//获取用户列表（分页）
		mock.onGet('/user/listpage').reply(config => {
			// 报警信息
			if (config.params.table=="报警信息") {
				let {page, name} = config.params;
				let mockDashboard = _Dashboard.filter(user => {
					if (name && user.name.indexOf(name) == -1 && version && user.version.indexOf(version) == -1) {return false;}
					return true;
				});
				let total_dashboard = mockDashboard.length;
				mockDashboard = mockDashboard.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total_dashboard,
							dashboard: mockDashboard
						}]);
					}, 1000);
				});
			}
			// 策略分析
			if(config.params.table=="策略分析"){
				let {page, name} = config.params;
				let mockUsers = _Users.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = mockUsers.length;
				mockUsers = mockUsers.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							users: mockUsers
						}]);
					}, 1000);
				});
			}
			// 产品管理
			if(config.params.table=="产品管理"){
				let {page, name} = config.params;
				let products_manage = _products_manage.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = products_manage.length;
				products_manage = products_manage.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							products_manage: products_manage
						}]);
					}, 1000);
				});
			}
			// 设备管理
			if(config.params.table=="设备管理"){
				let {page, name} = config.params;
				let celueData = _Users.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});

				let products_list = _products_list.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = products_list.length;
				products_list = products_list.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							products_list: products_list,
							celueData:celueData,

						}]);
					}, 1000);
				});
			} 
			// 产品固件
			if(config.params.table=="产品固件"){
				let {page, name} = config.params;
				let products_stable = _products_stable.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = products_stable.length;
				products_stable = products_stable.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							products_stable: products_stable
						}]);
					}, 1000);
				});
			}
			// 产品驱动
			if(config.params.table=="产品驱动"){
				let {page, name} = config.params;
				let products_drive = _products_drive.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = products_drive.length;
				products_drive = products_drive.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							products_drive: products_drive
						}]);
					}, 1000);
				});
			}
			// 应用添加
			if(config.params.table=="应用添加"){
				let {page, name} = config.params;
				let apply_add3 = _apply_add3.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = apply_add3.length;
				apply_add3 = apply_add3.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							apply_add3: apply_add3
						}]);
					}, 1000);
				});
			}
			// 账号管理
			if(config.params.table=="账号管理"){
				let {page, name,account} = config.params;
				let accountZhangHu = _accountZhangHu.filter(user => {
					if (name && user.name.indexOf(name) == -1 || account && user.account.indexOf(account) == -1) {return false;}
					return true;
				});
				let total = accountZhangHu.length;
				accountZhangHu = accountZhangHu.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							accountZhangHu: accountZhangHu
						}]);
					}, 1000);
				});
			}
			// 消息测试
			if(config.params.table=="消息测试"){
				let {page, name} = config.params;
				let news = _news.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = news.length;
				news = news.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							news: news
						}]);
					}, 1000);
				});
			}
			// 业务日志
			if(config.params.table=="业务日志"){
				let {page, name} = config.params;
				let business_log = _business_log.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = business_log.length;
				business_log = business_log.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							business_log: business_log
						}]);
					}, 1000);
				});
			}
			// 事件管理
			if(config.params.table=="事件管理"){
				let {page, name} = config.params;
				let device_event = _device_event.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = device_event.length;
				device_event = device_event.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							device_event: device_event
						}]);
					}, 1000);
				});
			}
			// 网关管理
			if(config.params.table=="网关管理"){
				let {page, name} = config.params;
				let device_list = _device_list.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = device_list.length;
				device_list = device_list.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							device_list: device_list
						}]);
					}, 1000);
				});
			}
			// 规则管理
			if(config.params.table=="规则管理"){
				let {page, name} = config.params;
				let rules_manage = _rules_manage.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = rules_manage.length;
				rules_manage = rules_manage.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							rules_manage: rules_manage
						}]);
					}, 1000);
				});
			}
			// 转发数据
			if(config.params.table=="转发数据"){
				let {page, name} = config.params;
				let Forwarding_data = _Forwarding_data.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = Forwarding_data.length;
				Forwarding_data = Forwarding_data.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							Forwarding_data: Forwarding_data
						}]);
					}, 1000);
				});
			}
			// 应用展览
			if(config.params.table=="应用展览"){
				let {page, name} = config.params;
				let apply_list = _apply_list.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = Forwarding_data.length;
				apply_list = apply_list.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							apply_list: apply_list
						}]);
					}, 1000);
				});
			}
			// 应用展览
			if(config.params.table=="应用类型"){
				let {page, name} = config.params;
				let apply_add1 = _apply_add1.filter(user => {
					if (name && user.name.indexOf(name) == -1) {return false;}
					return true;
				});
				let total = Forwarding_data.length;
				apply_add1 = apply_add1.filter((u, index) => index <10 * page && index >= 10 * (page - 1));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							total: total,
							apply_add1: apply_add1
						}]);
					}, 1000);
				});
			}
		});
		//删除用户
		mock.onGet('/user/remove').reply(config => {
			let { id } = config.params;
			console.log(config.params.table);
			// 策略分析
			if(config.params.table=="策略分析"){
				_Users = _Users.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 产品管理
			if(config.params.table=="产品管理"){
				_products_manage = _products_manage.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 设备管理
			if(config.params.table=="设备管理"){
				_products_list = _products_list.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 产品固件
			if(config.params.table=="产品固件"){
				_products_stable = _products_stable.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 产品驱动
			if(config.params.table=="产品驱动"){
				_products_drive = _products_drive.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 产品驱动
			if(config.params.table=="账号管理"){
				_accountZhangHu = _accountZhangHu.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 规则管理
			if(config.params.table=="规则管理"){
				_rules_manage = _rules_manage.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 转发数据
			if(config.params.table=="转发数据"){
				_Forwarding_data = _Forwarding_data.filter(u => u.id !== id);
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
		});
		//批量删除用户
		mock.onGet('/user/batchremove').reply(config => {
			console.log(config.params.table);
			// 设备管理
			if(config.params.table=='设备管理'){
				let { ids } = config.params;
				ids = ids.split(',');
				_products_list = _products_list.filter(u => !ids.includes(u.id));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 策略绑定
			if(config.params.table=='策略绑定'){
				let { ids } = config.params;
				ids = ids.split(',');
				_Users = _Users.filter(u => !ids.includes(u.id));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
			// 网关管理
			if(config.params.table=='网关管理'){
				let { ids } = config.params;
				ids = ids.split(',');
				_device_list = _device_list.filter(u => !ids.includes(u.id));
				return new Promise((resolve, reject) => {
					setTimeout(() => {
						resolve([200, {
							code: 200,
							msg: '删除成功'
						}]);
					}, 500);
				});
			}
      
		});
		//编辑用户
		mock.onGet('/user/edit').reply(config => {
			// 策略分析
			if (config.params.biao=="策略分析") {
				let { id, name, desc, rule, add_time, update_time } = config.params;
				_Users.some(u => {
					if (u.id === id) {
						u.name = name;
						u.desc = desc;
						u.rule = rule;
						u.add_time = add_time;
						u.update_time = update_time;
						return true;
					}
				});
			}
			// 产品管理
			if (config.params.biao=="产品管理") {
				let { id, name, sort, desc, rule, grn, strategy, describe } = config.params;
				_products_manage.some(u => {
					if (u.id === id) {
						u.name = name;
						u.desc = desc;
						u.rule = rule;
						u.sort = sort;
						u.strategy = strategy;
						u.rule = describe;
						u.grna= grn.grna;
						u.grnb = grn.grnb;
						return true;
					}
				});
			}
			// 设备管理
			if (config.params.biao=="设备管理") {
				console.log("设备管理");
				let {id, name, add_time, bandState, state, upline, rule, describe,level } = config.params;
				_products_list.some(u => {
					if (u.id === id) {
						u.name= name,
						u.rule= rule,
						u.state= state,
						u.level= level,
						u.add_time= add_time,
						u.upline= upline,
						u.describe= describe,
						u.bandState=bandState
						return true;
					}
				});
			}
			// 产品固件
			if (config.params.biao=="产品固件") {
				console.log("设备管理");
				let { id, name, version, desc, address } = config.params;
				_products_stable.some(u => {
					if (u.id === id) {
						u.name= name,
						u.version= version,
						u.desc= desc,
						u.address= address
						return true;
					}
				});
			}
			// 产品驱动
			if (config.params.biao=="产品驱动") {
				let { id, name, version, desc, address } = config.params;
				_products_drive.some(u => {
					if (u.id === id) {
						u.name= name,
						u.version= version,
						u.desc= desc,
						u.address= address
						return true;
					}
				});
			}
			// 账号管理
			if (config.params.biao=="账号管理") {
				let { id, name, createTime, tel, email ,user,menu,account } = config.params;
				_accountZhangHu.some(u => {
					if (u.id === id) {
						u.name= name,
						u.createTime= createTime,
						u.tel= tel,
						u.email= email,
						u.user= user,
						u.menu= menu,
						u.account= account
						return true;
					}
				});
			}
			return new Promise((resolve, reject) => {
				setTimeout(() => {
					resolve([200, {
						code: 200,
						msg: '编辑成功'
					}]);
				}, 500);
			});
		});
		//新增用户
		mock.onGet('/user/add').reply(config => {
			console.log(config.params.biao);
			// 策略分析
			if (config.params.biao=="策略分析") {
				let { name, desc, rule, add_time, update_time } = config.params;
				_Users.push({
					id: Mock.Random.guid(),
					name: name,
					desc: desc,
					rule: rule,
					add_time: add_time,
					update_time: update_time
				});
			}
			// 产品管理
			if (config.params.biao=="产品管理") {
				console.log("ok");
				let { name, sort, desc, rule, grn, strategy, describe } = config.params;
				_products_manage.push({
					id: Mock.Random.guid(),
					name: name,
					sort: sort,
					desc: desc,
					rule: rule,
					grna: grn.grna,
					grnb: grn.grnb,
					strategy: strategy,
					describe: describe
				});
			}
			// 设备管理
			if (config.params.biao=="设备管理") {
				console.log("ok");
				let { name, add_time, bandState, state, upline, rule, describe,level } = config.params;
				products_list.push({
					id: Mock.Random.guid(),
					name: name,
					rule: rule,
					level:level,
					state: state,
					add_time: add_time,
					upline: upline,
					describe: describe,
					bandState:bandState
				});
			}
			// 产品固件
			if (config.params.biao=="产品固件") {
				let { name, version, desc, address } = config.params;
				products_stable.push({
					id: Mock.Random.guid(),
					name: name,
					version: version,
					desc: desc,
					address: address,
				});
			}
			// 产品驱动
			if (config.params.biao=="产品驱动") {
				let { name, version, desc, address } = config.params;
				products_drive.push({
					id: Mock.Random.guid(),
					name: name,
					version: version,
					desc: desc,
					address: address,
				});
			}
			// 账号管理
			if (config.params.biao=="账号管理") {
				let { name, createTime, tel, email ,user,menu,account} = config.params;
				accountZhangHu.push({
					id: Mock.Random.guid(),
					name: name,
					createTime: createTime,
					tel: tel,
					email: email,
					user:user,
					menu:menu,
					account:account
				});
			}
			// 消息测试
			if (config.params.biao=="消息测试") {
				let { topic, date, test, GRN } = config.params;
				news.push({
					id: Mock.Random.guid(),
					topic: topic,
					date: date,
					test: test,
					GRN: GRN,
				});
			}
			// 规则管理
			if (config.params.biao=="规则管理") {
				let { name, date, state, format,desc } = config.params;
				rules_manage.push({
					id: Mock.Random.guid(),
					name: name,
					date: date,
					state: state,
					format: format,
					desc: desc,
				});
			}
			// 转发数据
			if (config.params.biao=="转发数据") {
				let { msg, topic, mysql, table} = config.params;
				Forwarding_data.push({
					id: Mock.Random.guid(),
					msg: msg,
					topic: topic,
					mysql: mysql,
					table: table,
				});
			}
			return new Promise((resolve, reject) => {
				setTimeout(() => {
					resolve([200, {
						code: 200,
						msg: '新增成功'
					}]);
				}, 500);
			});
		});

	}
};